package org.dtrd.modules.record.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninKetone;

import java.util.Date;

/**
 * @Author: QR
 * @Date: 2021/10/17-0:24
 */
@ApiModel("日常尿酮记录")
@Data
public class DailyKetoneRecordBean {

    @ApiModelProperty("记录id")
    private Integer dataId;

    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("记录日期")
    private String recordTime;

    @ApiModelProperty("描述")
    private String ketoneDescribe;

    @ApiModelProperty("记录照片")
    private String ketoneRecordPhoto;

    @ApiModelProperty(value = "尿酮值", notes = "尿酮的范围在 0 到 5 之间, 其中 0阴，1,2弱阳，3阳，4,5强阳")
    private Integer ketoneValue;

    @ApiModelProperty("备注")
    private String ketoneRemark;

    public DailyKetoneRecordBean(){}

    public DailyKetoneRecordBean(Integer patientId, Date date, Integer ketoneValue) {
        this.patientId = patientId;
        this.recordTime = DateUtils.formatDate(date, DateUtils.datetimeFormat.get().toPattern());
        this.ketoneValue = ketoneValue;
    }

    public DailyKetoneRecordBean parseFromPo(DtrdEntRdSigninKetone po) {
        this.setDataId(po.getDataId());
        this.setPatientId(po.getPatientId());
        if (po.getRecordTime() != null) {
            this.setRecordTime(DateUtils.formatDate(po.getRecordTime(), DateUtils.date_sdf.get().toPattern()));
        }
        this.setKetoneDescribe(po.getKetoneDescribe());
        this.setKetoneValue(po.getKetoneValue());
        this.setKetoneRemark(po.getKetoneRemark());
        this.setKetoneRecordPhoto(po.getRecordPhoto());
        return this;
    }
}
